package com.niodata.dp.monitor.sharelib.entity.file;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.niodata.dp.monitor.common.util.MathUtil;
import com.niodata.dp.util.FileUtil;
import com.niodata.dp.util.StringUtil;
import java.util.Date;

public class DataSetCompleteness {

  private String datasetId;
  private String datasetName;
  private String metaDataName;
  private double percentOfCompleteness;
  private long expectFileCount;
  private long realFileCount;
  private long missingFileCount;
  private long sizeErrorFileCount;
  private long nameErrorFileCount;
  private String currentMinPartition;
  private String currentMaxPartition;
  @JsonIgnore
  private long capacity;
  private String capacityWithUnit;
  @JsonFormat(shape = JsonFormat.Shape.STRING, timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
  private Date checkTime;

  public String getDatasetId() {
    return datasetId;
  }

  public void setDatasetId(String datasetId) {
    this.datasetId = datasetId;
  }

  public String getDatasetName() {
    return datasetName;
  }

  public void setDatasetName(String datasetName) {
    this.datasetName = datasetName;
  }

  public String getMetaDataName() {
    return metaDataName;
  }

  public void setMetaDataName(String metaDataName) {
    this.metaDataName = metaDataName;
  }

  public double getPercentOfCompleteness() {
    return MathUtil.handlePercentWithFixDecimalPlaces(percentOfCompleteness, 2);
  }

  public void setPercentOfCompleteness(double percentOfCompleteness) {
    this.percentOfCompleteness = percentOfCompleteness;
  }

  public long getExpectFileCount() {
    return expectFileCount;
  }

  public void setExpectFileCount(long expectFileCount) {
    this.expectFileCount = expectFileCount;
  }

  public long getRealFileCount() {
    return realFileCount;
  }

  public void setRealFileCount(long realFileCount) {
    this.realFileCount = realFileCount;
  }

  public long getMissingFileCount() {
    return missingFileCount;
  }

  public void setMissingFileCount(long missingFileCount) {
    this.missingFileCount = missingFileCount;
  }

  public long getSizeErrorFileCount() {
    return sizeErrorFileCount;
  }

  public void setSizeErrorFileCount(long sizeErrorFileCount) {
    this.sizeErrorFileCount = sizeErrorFileCount;
  }

  public long getNameErrorFileCount() {
    return nameErrorFileCount;
  }

  public void setNameErrorFileCount(long nameErrorFileCount) {
    this.nameErrorFileCount = nameErrorFileCount;
  }

  public String getCurrentMinPartition() {
    return currentMinPartition;
  }

  public void setCurrentMinPartition(String currentMinPartition) {
    this.currentMinPartition = currentMinPartition;
  }

  public String getCurrentMaxPartition() {
    return currentMaxPartition;
  }

  public void setCurrentMaxPartition(String currentMaxPartition) {
    this.currentMaxPartition = currentMaxPartition;
  }

  public long getCapacity() {
    return capacity;
  }

  public void setCapacity(long capacity) {
    this.capacity = capacity;
  }

  public String getCapacityWithUnit() {
    if (StringUtil.isEmpty(capacityWithUnit)) {
      capacityWithUnit = FileUtil.formatFileSize(this.capacity);
    }
    return capacityWithUnit;
  }

  public void setCapacityWithUnit(String capacityWithUnit) {
    this.capacityWithUnit = capacityWithUnit;
  }

  public Date getCheckTime() {
    return checkTime;
  }

  public void setCheckTime(Date checkTime) {
    this.checkTime = checkTime;
  }
}
